package manage;

import logIn.Manage;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;

/**
 * 员工管理界面
 * @Author Jian Chen long
 * @Date 2021/6/18 11:15
 */
public class ManageEmployees extends JFrame {
    private JLabel label = new JLabel("员工管理");

    private JButton allWorker = new JButton("全部员工");
    private JButton selectWorker = new JButton("员工查询");
    private JButton newWorker = new JButton("员工入职");
    private JButton dropWorker = new JButton("员工离职");

    private JPanel panel1 = new JPanel();
    private JPanel panel2 = new JPanel();

    public ManageEmployees(){
        panel1.add(label);
        panel2.add(newWorker);
        panel2.add(selectWorker);
        panel2.add(allWorker);
        panel2.add(dropWorker);
        this.add(panel1);
        this.add(panel2, BorderLayout.SOUTH);

        this.setTitle("员工管理");
        this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
        this.setSize(450,120);
        this.setLocationRelativeTo(null);
        this.setResizable(true);

        /**
         * 全部员工功能实现
         */
        allWorker.addActionListener(new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                new allWorker().setVisible(true);
            }
        });

        /**
         * 单个员工查询功能实现
         */
        selectWorker.addActionListener(new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                new selectWorker().setVisible(true);
            }
        });



        /**
         * 员工入职功能实现
         */
        newWorker.addActionListener(new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                new newInterFace().setVisible(true);
            }
        });



        /**
         * 员工离职功能实现
         */
        dropWorker.addActionListener(new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                new dropWorker().setVisible(true);
            }
        });
    }
}
